package com.lanchetech.admin.controller;

import com.lanchetech.admin.aop.OperatorLog;
import com.lanchetech.admin.service.RoomService;
import com.lanchetech.bean.request.AnchorReq;
import com.lanchetech.bean.request.RoomReq;
import com.lanchetech.bean.response.BasePageResp;
import com.lanchetech.bean.response.BaseResp;
import com.lanchetech.bean.response.ResultData;
import com.lanchetech.bean.vo.AnchorVO;
import com.lanchetech.bean.vo.RoomVO;
import com.lanchetech.entity.Room;
import com.lanchetech.entity.Spu;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@Api(value = "直播间接口", tags = "直播间接口")
@RequestMapping("/api/room")
@RestController
public class RoomController {

    @Autowired
    RoomService roomService;

    @ApiOperation("获取直播间列表")
    @PostMapping("/getRoomPage")
    public ResultData<BasePageResp<RoomVO>> getRoomPage(@RequestBody RoomReq req) {
        return roomService.getRoomPage(req);
    }

    @OperatorLog("删除直播间")
    @ApiOperation("删除直播间")
    @GetMapping("/deleteRoom")
    public BaseResp deleteRoom(@RequestParam("id") Long id) {
        return roomService.deleteRoom(id);
    }

    @OperatorLog("修改直播间状态")
    @ApiOperation("修改直播间状态")
    @GetMapping("/editRoomStatus")
    public BaseResp editRoomStatus(@RequestParam("id") Long id,@RequestParam("status") Byte status) {
        return roomService.editRoomStatus(id,status);
    }

    @OperatorLog("编辑直播间排序")
    @ApiOperation("编辑直播间排序")
    @PostMapping("/editRoomSort")
    public BaseResp editRoomSort(@RequestBody Room req) {
        return roomService.editRoomSort(req);
    }


}
